import { View } from "../../../mvc/core/View";
import { ILayOut } from "../../../../modules/interfaces/ILayOut";
import { LayerManager } from "../../manager/LayerManager";
import { UICompomentPool } from "../../../../com/mui/utils/UICompomentPool";
import { SecTimerView } from "./SecTimerView";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { ObjCreate } from "./ObjCreate";
import { Global } from "../../../../com/gengine/global/Global";
type int = number;
//class LeftTimeView
    
    export  class LeftTimeView extends View implements ILayOut
    {
        constructor(arg1: string="mm: ss")
        {
            super();
            this._parse = arg1;
            this.layer = LayerManager.msgTipLayer;
            this.resetPosition();
            this.mouseEnabled = false;
            this.mouseChildren = false;
            this.init();
            return;
        }

        public setParse(arg1: string="mm: ss"): void
        {
            this._parse = arg1;
            this._tfLeftTime.setParse(this._parse);
            return;
        }

        /* internal  */init(): void
        {
            this._tfLeftTime = UICompomentPool.getUICompoment(SecTimerView) as SecTimerView;
            this._tfLeftTime.filters = [FilterConst.glowFilter];
            this._tfLeftTime.mouseEnabled = false;
            var loc1=new GTextFormat(FontUtil.songtiName, 16, 16580352);
            loc1.align = flash.text.TextFormatAlign.RIGHT;
            loc1.bold = true;
            this._tfLeftTime.defaultTextFormat = loc1;
            this._tfLeftTime.filters = [FilterConst.glowFilter];
            this._tfLeftTime.setParse(this._parse);
            ObjCreate.setObjAttri(this._tfLeftTime, -300, 0, 300, 22, this);
            return;
        }

        public updateLeftTime(arg1: int): void
        {
            this._tfLeftTime.setLeftTime(arg1);
            return;
        }

        public get tfLeftTime(): SecTimerView
        {
            return this._tfLeftTime;
        }

        public resetPosition(): void
        {
            this.x = Global.stage.stageWidth - 380;
            this.y = 100;
            return;
        }

        public clean(): void
        {
            if (this.parent) 
            {
                this.parent.removeChild(this);
            }
            if (this._tfLeftTime) 
            {
                this._tfLeftTime.dispose(false);
                this._tfLeftTime = null;
            }
            return;
        }

        /* internal */ /* var */_parse: string;

        /* internal */ /* var */_tfLeftTime: SecTimerView;
    }
